package com.boesch.electroOffice.dataaccess.mapper.messerli;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.boesch.electroOffice.model.messerli.Project;

/**
 * This class mappes the rows from messerli database to a Project object.
 * 
 * @author Ralph Koster
 *
 */
public class ProjectMesserliMapper implements RowMapper<Project>, Serializable {

	private static final long serialVersionUID = 8437163797184362936L;

	/**
	 * Mapps all rows from database to a Project object.
	 * 
	 * @see org.springframework.jdbc.core.RowMapper
	 */
	public Project mapRow(ResultSet rs, int rowNum) throws SQLException {
		Project project = new Project();
		project.setProjectNumber(rs.getInt("AUFTRAG"));
		project.setDescription(rs.getString("KURZBEZ"));
		project.setObjectAddress(rs.getString("OBJECT_ADDR"));
		project.setCity(rs.getString("ORT"));

		return project;
	}
}
